<!DOCTYPE html>
<html lang="zh-cn">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <meta name="renderer" content="webkit">
  <title>网站信息</title>
  <link rel="stylesheet" href="../css/pintuer.css">
  <link rel="stylesheet" href="../css/admin.css">
  <script src="../js/jquery.js"></script>
  <script src="../js/pintuer.js"></script>
  <script src="../js/jquery.form.js"></script>
</head>

<body>
  <div class="panel admin-panel">
    <div class="panel-head"><strong><span class="icon-pencil-square-o"></span>修改酒品</strong></div>
    <div class="body-content">
      <form class="form-x" id="assetForm" enctype="multipart/form-data">
        <div class="form-group">
          <div class="label">
            <label>ID：</label>
          </div>
          <div class="field">
            <input type="text" id="url7" name="id" class="input tips" style="width:25%; float:left;" value="" />
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>酒名：</label>
          </div>
          <div class="field">
            <input type="text" id="url1" name="winename" class="input tips" style="width:25%; float:left;" value="" />
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>酒种ID：</label>
          </div>
          <div class="field">
            <input type="text" id="url2" name="kindid" class="input tips" style="width:25%; float:left;" value="" />
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>价格：</label>
          </div>
          <div class="field">
            <input type="text" id="url3" name="price" class="input tips" style="width:25%; float:left;" value="" />
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>图片：</label>
          </div>
          <div class="field">
            <input type="text" id="url4" name="img" class="input tips" style="width:25%; float:left;" value="" />
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>点酒数：</label>
          </div>
          <div class="field">
            <input type="text" id="url5" name="count" class="input tips" style="width:25%; float:left;" value="" />
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>库存：</label>
          </div>
          <div class="field">
            <input type="text" id="url6" name="inventory" class="input tips" style="width:25%; float:left;" value="" />
            <div class="tips"></div>
          </div>
          <div class="form-group">
            <div class="label">
              <label></label>
            </div>
            <div class="field" style="margin-top: 20px">
              <button class="button bg-main icon-check-square-o" type="button" id="agreementSub">修改</button>
            </div>
          </div>
        </div>
      </form>
      <div id="info"></div>
    </div>
  </div>
</body>
<script>
  $(document).ready(function () {
    $('#agreementSub').on('click', function () {
      $('#assetForm').ajaxSubmit({
        url: 'http://127.0.0.1:8080/wineapi/wineupdate',
        type: 'get',
        dataType: 'json',
        data: $('#assetForm').serialize(),
        success: function (data) {
          if (data.code == "ok") {
            window.location.href = "../components/wine.html"
          } else {
            var str =
                `
                    <div class="alert alert-red">
                        <span class="close rotate-hover"></span><strong>错误：</strong>没有该ID。
                    </div>
                `
            $('#info').html(str)
            setTimeout(function () {
              $('#info').html('')
            }, 2000)
          }
        },
        error: function (err) {
          console.log(err)
        },
        clearForm: false, //禁止清除表单
        resetForm: false //禁止重置表单
      })
    })
  })
</script>

</html>